package com.yeren.Reflection.Class;

import java.lang.reflect.Method;
/**
 * 
 */
public class ClassAPIDemo2 {
	public static void main(String[] args) throws NoSuchMethodException, SecurityException {
		Class<SunClass> class1 = SunClass.class;
		Method declaredMethod = class1.getDeclaredMethod("c", new Class[]{String.class,int.class});
		System.out.println("declaredMethod:"+declaredMethod);
		Method[] declaredMethods = class1.getDeclaredMethods();
		for(Method m:declaredMethods){
			System.out.println(m.getName());
		}
	/**************************************************************/
		System.out.println("===================================");
		Method[] methods = class1.getMethods();
		for(Method m:methods){
			System.out.println(m.getName());
		}
		Method method = class1.getMethod("d", new Class[]{boolean.class,String.class});
		System.out.println("method:"+method);
	}
}

class FatherClass{
	private void a(int a){
		
	}
	
	public void b(String str){
		
	}
}

class SunClass extends FatherClass{
	private void c(String str,int len){
		
	}
	
	public void d(boolean flag,String str){
		
	}
}
